#Converse
#Version 0.1
#GPL V3
#Code with three ### at the end is dbug code and will be commented out for final program
import os
import sys
"""
Talky Module

Functions
converse()
"""

def GetRelativeDir(): #Get the Working Directory
    #print "in GetRelativeDir()"###
    
    dir = os.getcwd()#gets current dir
    
    if os.access(dir, os.W_OK) == False: #Check for Readability
        return "Current Directory Locked....Exiting"
    
    else:
        return dir

def file_name(list): #function to get the property_name from list
    prop1 = list[0] #property1
    
    prop1 = prop1.replace("\n", "")
    
    return prop1
def file_descript(list): #function to get the property_description from list
    prop1 = list[1]
    
    prop1 = prop1.replace("\n", "")
    
    return prop1

def converse_input(name,desc): #UserInput Component
    print "Say Somethin, maybe Hi?"
    
    input_usr = raw_input()
    input_usr + ""
    input_usr = input_usr.lower()
    
    #print input_usr ###
    
    if input_usr == name:
        print desc
    else:
        print "No match Found"
    
def converse(): #MainFunction
    print "Enter Word Filename"
    
    input_file = raw_input()
    
    #print "InConverse()"###
    
    CurDir = GetRelativeDir() #current directory
    
    #print CurDir ###
    
    slash = "/"
    
    filename = CurDir+slash+input_file #join CurDir and input_file
    
    fileopen = open(filename, "r")#open file for reading
    
    #print fileopen ###
    
    if os.access(filename, os.R_OK) == False: #check if file can be read
        print filename, "locked.....Exiting"
    
    start_line = 0 #line to read from
    

    file_lst = fileopen.readlines() #read the file
    
    file_n = file_name(file_lst)#get the first property in the file
    
    file_d = file_descript(file_lst)
    
    #print file_n,"PROP_NAME" ###
    
    #print file_d, "PROP_DESC" ###
    
    #print file_lst,"RAWLIST" ###
    

    
    converse_input(file_n, file_d)
    
    raw_input()
    
    fileopen.close()
    
    return "done"

    
    



if __name__ =="__main__":
    converse()
